<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

class Login extends CI_Controller
{
	
    public function __construct()
    {
        parent::__construct();
    }

    public function index()
    {
    	$data = array(
    	  'title_for_layout' => 'AMCGIL',
    	  'content-layout'   => 'modulos/home/home'
    	);
        $this->load->view('template/layout_main',$data);
    }

    public function login()
    {

        $config = array(
            array(
                'field' => 'login',
                'label' => 'Login',
                'rules' => 'required|min_length[4]|max_length[10]|htmlspecialchars|xss_clean'
            ),
            array(
                'field' => 'senha',
                'label' => 'senha',
                'rules' => 'required|min_length[4]|max_length[10]|htmlspecialchars|md5'
            )
        );
        $this->form_validation->set_rules($config);
        if ($this->form_validation->run() == FALSE)
        {
            $this->index();
        }
        else
        {
        	$data = array(
        	   'login' => $this->input->post( 'login' ),
        	   'senha' => $this->input->post( 'senha' )
        	);
            $this->load->model( 'admin/usuario_model' );
            $login = $this->usuario_model->login( $data );
            if ( count( $login ) > 0)
            {
                
            }
        }
    }
}

/* End of file login.php */
/* Location: ./application/controller/login.php */